import {
    reqSearchList
} from "@/api"
export default {
    actions: {
        // 获取搜索模块的商品数据
       async searchList({commit},params = {} ) {
          let result = await reqSearchList(params)
          if(result.code == 200) {
            commit('SEARCHLIST',result.data)
          }else {
            alert('处理吧')          
           }
        }
    },
    mutations: {
        SEARCHLIST(state,searchList) {
            state.searchList = searchList
        }
    },
    state: {
        searchList:{}
    },
    // 为简化数据而生
    getters: {
        // 简化商品列表的数据
        goodsList(state) {
            return state.searchList.goodsList || []
        },
        // 简化品牌列表的数据
        attrsList(state) {
            return state.searchList.attrsList
        },
        trademarkList(state) {
            return state.searchList.trademarkList
        },
    }
}